home *** CD-ROM | disk | FTP | other *** search
- unit uBase;
-
- interface
-
- uses
- Classes;
-
- const
- mskCurrency = '%.0m'; { whole unit currency }
-
- type
- TAmountsList = class(TList)
- { This is a generic class that manages a list of dollar amounts (stored
- as LongInts). }
- protected
- function GetItem(aIndex: Integer): LongInt;
- procedure SetItem(aIndex: Integer; aValue: LongInt);
- public
- procedure Add(aValue: LongInt);
- procedure Assign(aSource: TAmountsList);
- procedure ZeroOut;
- property Items[aIndex: Integer]: LongInt read GetItem write SetItem; default;
- end;
-
-
- implementation
-
- { TAmountsList }
-
- function TAmountsList.GetItem(aIndex: Integer): LongInt;
- begin
- Result := 0;
- if aIndex < Count then
- Result := LongInt(inherited Items[aIndex]);
- end;
-
- procedure TAmountsList.SetItem(aIndex: Integer; aValue: LongInt);
- begin
- inherited Items[aIndex] := Pointer(aValue);
- end;
-
- procedure TAmountsList.Add(aValue: LongInt);
- begin
- inherited Add(Pointer(aValue));
- end;
-
- procedure TAmountsList.Assign(aSource: TAmountsList);
- var
- I: Integer;
- begin
- Clear;
- for I := 0 to aSource.Count - 1 do
- Add(aSource.Items[I]);
- end;
-
- procedure TAmountsList.ZeroOut;
- var
- I: Integer;
- begin
- for I := 0 to Count - 1 do
- Items[I] := 0;
- end;
-
- end.
-